module tiandimigong_p81b {
	export class 控制台点击 extends TriggerEvent{
		constructor(public obj:unknown, public 控制台按钮参数:string) {
			super()
		}
		readonly event_name: string = "控制台点击"
		readonly autoForward: boolean = true
	}
	export let 创建Toast:(Toast文案:string)=>void = (Toast文案:string):void => {
		let Toast面板: _OBJ__gui_ctrl_panel | undefined;
		let Toast文字: _OBJ__gui_ctrl_label | undefined;
		let ToastPage: _OBJ__gui_ctrl_gui_ctrl | undefined;
		ToastPage = base.gui_new("ToastPage");
		Toast文字 = base.gui_get_part_as<_OBJ__gui_ctrl_label>(ToastPage, "Toast文本");
		Toast面板 = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(ToastPage, "Toast面板");
		Toast文字.text = Toast文案;
		base.timer_wait(2, (计时器:Timer):void => {
			Toast面板.show = false;
		});
		base.timer_wait(4, (计时器:Timer):void => {
			base.gui_destory(ToastPage);
		});
	}
	export let 创建Success:(Success文案:string)=>void = (Success文案:string):void => {
		let Success面板: _OBJ__gui_ctrl_panel | undefined;
		let Success文字: _OBJ__gui_ctrl_label | undefined;
		let SuccessPage: _OBJ__gui_ctrl_gui_ctrl | undefined;
		SuccessPage = base.gui_new("SuccessPage");
		Success文字 = base.gui_get_part_as<_OBJ__gui_ctrl_label>(SuccessPage, "Success文本");
		Success面板 = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(SuccessPage, "Success面板");
		Success文字.text = Success文案;
		base.timer_wait(2, (计时器:Timer):void => {
			Success面板.show = false;
		});
		base.timer_wait(4, (计时器:Timer):void => {
			base.gui_destory(SuccessPage);
		});
	}
	export let 创建Warning:(Warning文案:string)=>void = (Warning文案:string):void => {
		let Warning面板: _OBJ__gui_ctrl_panel | undefined;
		let Warning文字: _OBJ__gui_ctrl_label | undefined;
		let WarningPage: _OBJ__gui_ctrl_gui_ctrl | undefined;
		WarningPage = base.gui_new("WarningPage");
		Warning文字 = base.gui_get_part_as<_OBJ__gui_ctrl_label>(WarningPage, "Warning文本");
		Warning面板 = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(WarningPage, "Warning面板");
		Warning文字.text = Warning文案;
		base.timer_wait(2, (计时器:Timer):void => {
			Warning面板.show = false;
		});
		base.timer_wait(4, (计时器:Timer):void => {
			base.gui_destory(WarningPage);
		});
	}
	function _TRIG_自定义事件_提醒信息_FUNC(this: void, 当前触发器: Trigger, e:服务端_提醒信息) {
		if (true) {
			log.debug("提示信息参数为：", e.信息类型);
			switch (e.信息类型) {
				case (("TOAST") as unknown as string): {
					tiandimigong_p81b.创建Toast(e.提醒信息);
					break;
				}
				case (("WARNING") as unknown as string): {
					tiandimigong_p81b.创建Warning(e.提醒信息);
					break;
				}
				case (("SUCCESS") as unknown as string): {
					tiandimigong_p81b.创建Success(e.提醒信息);
					break;
				}
				default : {
					break;
				}
			}
		}
	}
	export let 自定义事件_提醒信息 = base.trigger_new(_TRIG_自定义事件_提醒信息_FUNC, [], false, undefined, true)
	export class Toast自定义事件 extends TriggerEvent{
		constructor(public obj:unknown) {
			super()
		}
		readonly event_name: string = "Toast自定义事件"
		readonly autoForward: boolean = false
	}
	export let 根据点击位置动态调整预览页面位置:(点击物品的背包编号:number, 点击物品的格子编号:number)=>undefined = (点击物品的背包编号:number, 点击物品的格子编号:number):undefined => {
		let 编号取余: number = 0;
		let 偏移宽度: number = 0;
		let 自定义物品信息: _OBJ__gui_ctrl_panel = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "自定义物品信息");
		if (((点击物品的背包编号 == 1))) {
			log.debug(自定义物品信息.layout.relative[1]);
			编号取余 = ((5 + 点击物品的格子编号) % 6);
			偏移宽度 = ((编号取余 * 121) - 100);
			自定义物品信息.layout.relative[1] = 偏移宽度;
		} else {
			偏移宽度 = 300;
			自定义物品信息.layout.relative[1] = 偏移宽度;
		}
	}
	export let 关闭物品信息预览页面:()=>void = ():void => {
		base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "自定义物品信息").show = false;
		base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "自定义物品信息点击背景").show = false;
	}
	export let 设置物品的装备条件:(传入的物品:Item, 需要修改的框图:_OBJ__gui_ctrl_panel, 需要修改的文本:_OBJ__gui_ctrl_label)=>string = (传入的物品:Item, 需要修改的框图:_OBJ__gui_ctrl_panel, 需要修改的文本:_OBJ__gui_ctrl_label):string => {
		let 返回的结果: string = "";
		let 装备要求拼接: string = "";
		let 是否可装备: boolean = true;
		传入的物品.foreach_attr_need((属性:string, 数值:string):void => {
			装备要求拼接 = 属性.concat(" ", 数值, " ");
			// 只考虑一个词条的情况，多个词条其实也行，但是不做那么复杂了
			是否可装备 = tiandimigong_p81b.根据装备条件决定显示的样式(属性, 数值);
		});
		if (((是否可装备 == true))) {
			log.debug("默认颜色是", 需要修改的文本.font.color);
		} else {
			log.debug("默认颜色是", 需要修改的文本.font.color);
		}
		if (((装备要求拼接 == ""))) {
			返回的结果 = "无装备要求";
		} else {
			返回的结果 = "装备需求： ".concat(装备要求拼接);
		}
		return 返回的结果;
	}
	export let 获得物品的品质背景图:(传入品质:number)=>string = (传入品质:number):string => {
		log.debug("传入的值为", 传入品质);
		switch (传入品质) {
			case 1: {
				return "image/item/品质1.png";
				break;
			}
			case 2: {
				return "image/item/品质2.png";
				break;
			}
			case 3: {
				return "image/item/品质3.png";
				break;
			}
			case 4: {
				return "image/item/品质4.png";
				break;
			}
			case 5: {
				return "image/item/品质5.png";
				break;
			}
			case 6: {
				return "image/item/品质6.png";
				break;
			}
			case 7: {
				return "image/item/品质7.png";
				break;
			}
			default : {
				break;
			}
		}
	}
	export let 根据装备条件决定显示的样式:(装备条件属性:string, 装备条件数值:string)=>boolean = (装备条件属性:string, 装备条件数值:string):boolean => {
		let 主控单位属性: string = "字符串";
		let 主控单位属性值: number = 0;
		log.debug("装备条件是：", 装备条件属性, 装备条件数值);
		主控单位属性值 = base.player_local().get_hero().get(base.force_as<单位属性>(装备条件属性));
		if (((主控单位属性值 >= base.force_as<number>(装备条件数值)))) {
			log.debug("可以装备");
			return true;
		} else {
			log.debug("不能装备");
			return false;
		}
	}
	export let 是否开启自定义物品预览: boolean = false;
	function _TRIG_选中物品_FUNC(this: void, 当前触发器: Trigger, e:base.鼠标点击物品栏中物品) {
		let 新变量: Array<IdPreset<"buff_id">> = new Array<IdPreset<"buff_id">>();
		let 物品数编表: _OBJ__item_Item = e.item.cache;
		let 物品名称: string = "物品名称";
		let 物品说明: string = "物品说明";
		let 装备要求文本: _OBJ__gui_ctrl_label | undefined;
		let 装备要求外框: _OBJ__gui_ctrl_panel | undefined;
		let 物品图标控件: _OBJ__gui_ctrl_panel | undefined;
		let 物品图标品质背景: _OBJ__gui_ctrl_panel | undefined;
		let 物品预览品质背景: _OBJ__gui_ctrl_panel | undefined;
		let 物品名称控件: _OBJ__gui_ctrl_label | undefined;
		let 物品说明控件: _OBJ__gui_ctrl_label | undefined;
		let 物品品质背景色控件: _OBJ__gui_ctrl_panel | undefined;
		if (((tiandimigong_p81b.是否开启自定义物品预览 == true))) {
			e.item.foreach_extra_attr((属性:单位属性, 属性类型:UnitPropertySubType, 数值:number, 是装备属性:boolean):void => {
				// 对查询到的属做操作
			});
			base.send_custom_event(new tiandimigong_p81b.自定义事件去服务端拿数据细节(((base.game) as unknown as base.Game), e.item));
			tiandimigong_p81b.根据点击位置动态调整预览页面位置(e.item.inv_index, e.item.slot_index);
			e.item_tooltip_panel.show = false;
			// 构造UI面板的各项属性
			// 构造UI面板的各项属性
			// 构造UI面板的各项属性
			if (((e.item.get_all_extra_mod(((true) as unknown as IsEquipped)).length == 0))) {
			} else {
				if (新变量 !== undefined) {
					for (let [遍历到的数组索引, 遍历到的数组元素] of base.ArrayIterator(新变量 as unknown as Array<IdPreset<"buff_id">>)) {
						log.debug("词缀", 遍历到的数组索引, 遍历到的数组元素);
					}
				} else {
					log.warn("不能遍历：新变量")
				}
			}
			// ——————构造物品icon
			物品图标控件 = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "物品信息底图");
			物品图标控件.image = e.item.get_icon();
			物品图标品质背景 = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "物品信息品质框");
			物品图标品质背景.image = e.item.get_item_quality_frame();
			// ——————构造物品品质背景图
			物品预览品质背景 = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "物品品质背景色板");
			物品预览品质背景.image = tiandimigong_p81b.获得物品的品质背景图(e.item.get_item_quality());
			// ——————构造物品名称
			物品名称 = e.item.get_show_name();
			物品名称控件 = base.gui_get_part_as<_OBJ__gui_ctrl_label>(tiandimigong_p81b.物品信息预览页面实例, "物品名称");
			物品名称控件.text = 物品名称;
			// ——————构造装备条件
			装备要求文本 = base.gui_get_part_as<_OBJ__gui_ctrl_label>(tiandimigong_p81b.物品信息预览页面实例, "装备要求文本");
			装备要求外框 = base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "装备要求");
			tiandimigong_p81b.设置物品的装备条件(e.item, 装备要求外框, 装备要求文本);
			// ——————构造装备说明
			物品说明 = base.i18n.get_text_ex(e.item.get_tips(), base.i18n.get_lang());
			物品说明控件 = base.gui_get_part_as<_OBJ__gui_ctrl_label>(tiandimigong_p81b.物品信息预览页面实例, "装备介绍词条");
			物品说明控件.text = 物品说明;
			// ——————构造装备说明
			log.debug("构造装备说明", e.item.get_tips(), "string");
			base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "物品品质背景色板").show = true;
			base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "自定义物品信息").show = true;
			base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "自定义物品信息点击背景").show = true;
			log.debug("按下了物品");
		}
	}
	export let 选中物品 = base.trigger_new(_TRIG_选中物品_FUNC, [], false, undefined, true)
	export let 物品信息预览页面实例: _OBJ__gui_ctrl_gui_ctrl | undefined;
	function _TRIG_物品信息预览页面初始化_FUNC(this: void, 当前触发器: Trigger, e:base.游戏开始) {
		if (true) {
			tiandimigong_p81b.物品信息预览页面实例 = base.gui_new("ItemInfoPage");
			base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "自定义物品信息").show = false;
			base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.物品信息预览页面实例, "自定义物品信息点击背景").show = false;
		}
	}
	export let 物品信息预览页面初始化 = base.trigger_new(_TRIG_物品信息预览页面初始化_FUNC, [], false, undefined, true)
	function _TRIG_切换自定义物品预览状态_FUNC(this: void, 当前触发器: Trigger, e:切换自定义物品预览状态) {
		if (true) {
			tiandimigong_p81b.是否开启自定义物品预览 = !(tiandimigong_p81b.是否开启自定义物品预览);
			log.debug("是否开启自定义物品预览“:", tiandimigong_p81b.是否开启自定义物品预览);
		}
	}
	export let 切换自定义物品预览状态 = base.trigger_new(_TRIG_切换自定义物品预览状态_FUNC, [], false, undefined, true)
	export class 自定义事件去服务端拿数据细节 extends TriggerEvent{
		constructor(public obj:base.Game, public 选中物品:Item) {
			super()
		}
		readonly event_name: string = "自定义事件去服务端拿数据细节"
		readonly autoForward: boolean = true
	}
	export let 自定义物品描述函数:(物品品质:number)=>string = (物品品质:number):string => {
		let 返回的物品描述: string = "";
		log.debug("调用自定义物品描述函数", "品质为", 物品品质);
		switch (物品品质) {
			case 0: {
				返回的物品描述 = "这是一把平平无奇的单手剑";
				break;
			}
			case 1: {
				返回的物品描述 = "这把单手剑经过精心打磨，剑刃更加锋利，剑身更加坚固";
				break;
			}
			case 2: {
				返回的物品描述 = "这把剑的剑刃已经经过特殊的锻造工艺处理，不仅锋利无比，而且耐用度大大提高";
				break;
			}
			case 3: {
				返回的物品描述 = "这把剑的剑柄由珍贵的材料制成，握感极佳，且剑身更加轻盈，使得剑的攻击速度和灵活性大大提升";
				break;
			}
			case 4: {
				返回的物品描述 = "这把剑的剑身上镶嵌了稀有仙玉，每一剑挥出都有独特的韵味";
				break;
			}
			case 5: {
				返回的物品描述 = "剑身上散发出神秘的光芒，剑的力量和速度都达到了极致";
				break;
			}
			case 6: {
				返回的物品描述 = "这把剑的剑刃上刻有古老的伏羲印，在战斗中能发挥出强大的力量";
				break;
			}
			case 7: {
				返回的物品描述 = "这把剑是剑中的王者，剑身由伏羲亲自锻造，剑刃无坚不摧，剑的力量可以撼动天地，任何剑在它面前都显得微不足道";
				break;
			}
			default : {
				break;
			}
		}
		return 返回的物品描述;
	}
	export class 多功能物品面板按钮点击 extends TriggerEvent{
		constructor(public obj:base.Game, public 面板绑定的物品:Item, public 功能参数:string) {
			super()
		}
		readonly event_name: string = "多功能物品面板按钮点击"
		readonly autoForward: boolean = true
	}
	function _TRIG_开启多功能物品面板并选中物品时_FUNC(this: void, 当前触发器: Trigger, e:base.鼠标点击物品栏中物品) {
		let 物品面板: _OBJ__gui_ctrl_panel = base.gui_get_part_as<any>(tiandimigong_p81b.多功能物品面板页面实例, "多功能物品面板");
		let 多功能格子: _OBJ_smallcard_inventory_gui_ctrl_多功能格子 = base.gui_get_part_as<any>(tiandimigong_p81b.多功能物品面板页面实例, "多功能格子");
		if (((物品面板.show == true))) {
			e.item_tooltip_panel.show = false;
			多功能格子.bind_item = e.item;
		}
	}
	export let 开启多功能物品面板并选中物品时 = base.trigger_new(_TRIG_开启多功能物品面板并选中物品时_FUNC, [], false, undefined, true)
	function _TRIG_多功能物品面板显示控制_FUNC(this: void, 当前触发器: Trigger, e:显示或关闭多功能物品面板) {
		let 物品面板: _OBJ__gui_ctrl_panel = base.gui_get_part_as<any>(tiandimigong_p81b.多功能物品面板页面实例, "多功能物品面板");
		let 多功能格子: _OBJ_smallcard_inventory_gui_ctrl_多功能格子 = base.gui_get_part_as<any>(tiandimigong_p81b.多功能物品面板页面实例, "多功能格子");
		if (true) {
			if (((物品面板.show == true))) {
				物品面板.show = false;
				tiandimigong_p81b.清空多功能格子绑定物品();
			} else {
				物品面板.show = true;
			}
		}
	}
	export let 多功能物品面板显示控制 = base.trigger_new(_TRIG_多功能物品面板显示控制_FUNC, [], false, undefined, true)
	export let 多功能物品面板页面实例: _OBJ__gui_ctrl_gui_ctrl | undefined;
	function _TRIG_多功能物品面板实例初始化_FUNC(this: void, 当前触发器: Trigger, e:base.游戏开始) {
		if (true) {
			tiandimigong_p81b.多功能物品面板页面实例 = base.gui_new("多功能物品页");
			base.gui_get_part_as<_OBJ__gui_ctrl_panel>(tiandimigong_p81b.多功能物品面板页面实例, "多功能物品面板").show = false;
			log.debug("触发自定义事件的值：", tiandimigong_p81b.多功能物品面板页面实例.show);
		}
	}
	export let 多功能物品面板实例初始化 = base.trigger_new(_TRIG_多功能物品面板实例初始化_FUNC, [], false, undefined, true)
	export let 获取当前多功能格子绑定的物品:()=>Item = ():Item => {
		let 多功能格子: _OBJ_smallcard_inventory_gui_ctrl_多功能格子 = base.gui_get_part_as<any>(tiandimigong_p81b.多功能物品面板页面实例, "多功能格子");
		return 多功能格子.bind_item;
	}
	export let 清空多功能格子绑定物品:()=>void = ():void => {
		let 多功能格子: _OBJ_smallcard_inventory_gui_ctrl_多功能格子 = base.gui_get_part_as<any>(tiandimigong_p81b.多功能物品面板页面实例, "多功能格子");
		多功能格子.bind_item = undefined;
	}
	function _TRIG_丢弃物品的判断_FUNC(this: void, 当前触发器: Trigger, e:base.单位失去物品) {
		if (((e.unit == base.player_local().get_hero()))) {
			if (((e.item == tiandimigong_p81b.获取当前多功能格子绑定的物品()))) {
				tiandimigong_p81b.清空多功能格子绑定物品();
			} else {
			}
		}
	}
	export let 丢弃物品的判断 = base.trigger_new(_TRIG_丢弃物品的判断_FUNC, [], false, undefined, true)
	export type 提醒信息预设值 = string
	//以下为转发事件
	export class 切换自定义物品预览状态 extends TriggerEvent{
		constructor(public obj:unknown) {
			super()
		}
		readonly event_name: string = "切换自定义物品预览状态"
		readonly autoForward: boolean = false
	}
	export class 显示或关闭多功能物品面板 extends TriggerEvent{
		constructor(public obj:unknown) {
			super()
		}
		readonly event_name: string = "显示或关闭多功能物品面板"
		readonly autoForward: boolean = false
	}
	export class 服务端_提醒信息 extends TriggerEvent{
		constructor(public obj:unknown, public 提醒信息:string, public 信息类型:string) {
			super()
		}
		readonly event_name: string = "服务端_提醒信息"
		readonly autoForward: boolean = false
	}
	//为触发器添加事件
	自定义事件_提醒信息.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "服务端_提醒信息" })
	选中物品.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "鼠标-点击物品栏格子时" })
	物品信息预览页面初始化.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "游戏-开始" })
	切换自定义物品预览状态.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "切换自定义物品预览状态" })
	开启多功能物品面板并选中物品时.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "鼠标-点击物品栏格子时" })
	多功能物品面板显示控制.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "显示或关闭多功能物品面板" })
	多功能物品面板实例初始化.add_event_common({ obj: ((base.game) as unknown as base.Game), event_name: "游戏-开始" })
	丢弃物品的判断.add_event_common({ obj: ((base.any_unit) as unknown as base.PUnitAny), event_name: "单位-失去物品" })
}
